package com.beeway.blackgoose.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.beeway.blackgoose.R;
import com.beeway.blackgoose.bean.ListMessage;
import com.lidroid.xutils.BitmapUtils;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

import java.util.List;

/**
 * @说 明：
 * @项目名称：BlackGoose
 * @包 名： com.beeway.blackgoose.adapter
 * @类 名：
 * @创 建人：chenshuangniu
 * @创建时间：2015 2015/9/17
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */

public class ListShowAdapter extends MyBaseAdapter {
    private List<ListMessage> list ;
    public ListShowAdapter(Context context, List<ListMessage> list, BitmapUtils bitmapUtils) {
        super(context, list, bitmapUtils);
        this.list = list;
    }

    @Override
    public View getItemView(int position, View view, ViewGroup parent) {
        ViewHodler vh;
        if (view==null){
            view = inflate.inflate(R.layout.list_item_layout,null);
            vh = new ViewHodler(view);
            view.setTag(vh);
        }else {
            vh = (ViewHodler) view.getTag();
            ListMessage lm = list.get(position);
            vh.nameTv.setText(lm.getName());
            vh.detailTv.setText(lm.getDetal());
            vh.timeTv.setText(lm.getTime());
            bitmapUtils.display(vh.headIv,lm.getImgageUrl());
        }
        return view;
    }
    private static class ViewHodler{
        @ViewInject(R.id.tv_itme_canture)
        private TextView nameTv;
        @ViewInject(R.id.tv_item_detail)
        private TextView detailTv;
        @ViewInject(R.id.tv_item_time)
        private TextView timeTv;
        @ViewInject(R.id.igv_guide_welcome)
        private ImageView headIv;
        public ViewHodler(View view){
            ViewUtils.inject(this,view);
        }
    }
}
